<?php

use Jialeo\LaravelSchemaExtend\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateVideoGoodsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (!Schema::hasTable('c_video_goods')) {
            Schema::create('c_video_goods', function (Blueprint $table) {
                $table->increments('id')->comment('自增ID');
                $table->string('video_title', 100)->comment('标题');
                $table->integer('video_course_id')->comment('课程分类表ID');
                $table->tinyInteger('video_type')->default(0)->comment('添加方式(1:原创2:其他3:后台)');
                $table->text('video_intro')->comment('简介');
                $table->string('video_chapter')->comment('章节');
                $table->string('video_path')->default("")->nullable()->comment('视频地址');
                $table->decimal('video_reference_price')->default(0.00)->nullable()->comment('参考价格');
                $table->integer('video_ratio')->default(0)->nullable()->comment('分成比例');
                $table->decimal('video_retail_price')->default(0.00)->nullable()->comment('售价');
                $table->tinyInteger('video_racking')->default(1)->nullable()->comment('是否上架(1:下架,2:上架)');
                $table->text('video_describe')->comment('视频描述');
                $table->integer('video_sales')->default(0)->nullable()->comment('销量');
                $table->integer('video_score')->default(0)->nullable()->comment('评分');
                $table->tinyInteger('video_audit_status')->default(1)->nullable()->comment('审核状态(1:待审核，2:审核通过)');
                $table->integer('video_add_user_id')->comment('添加用户');
                $table->tinyInteger('video_add_type')->comment('1:医护端上传，2:后台上传');
                $table->integer('video_audit_user_id')->default(0)->nullable()->comment('审核用户');
                $table->timestamps();
                $table->comment = '视频商品表';
            });
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('c_video_goods');
    }
}
